You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sort parameter list when sortable, when it's an array of arrays by a scalar value's key.
For example, see admin siteaccess field templates by decreasing priority: php bin/console ibexa:debug:config field_templates --siteaccess admin --sort priority --reverse-sort
throw new InvalidArgumentException('--sort', "'$parameter' is a hash but sort can be used only on a list (an array with numeral keys incremented from zero).");
The reason will be displayed to describe this comment to others. Learn more.
Instead of letting these input-validation exceptions bubble, you could catch them, print a styled error, and return Command::INVALID or use Command::FAILURE for runtime errors.
The reason will be displayed to describe this comment to others. Learn more.
is_scalar() allows bool, int, float, string. Mixed types across items (e.g., "10" and 2, or "abc" and 1) will be coerced by <=>, often in surprising ways (non-numeric strings become 0 in numeric comparisons). You could enforce type consistency across the list for the $sort key, or detect the predominant type and normalize.
The reason will be displayed to describe this comment to others. Learn more.
For CLI argument validation you could use a Symfony\Component\Console\Exception\InvalidArgumentException. It integrates better with Console error styling and exit codes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Sort parameter list when sortable, when it's an array of arrays by a scalar value's key.
For example, see
adminsiteaccess field templates by decreasing priority:php bin/console ibexa:debug:config field_templates --siteaccess admin --sort priority --reverse-sortFor QA:
Documentation: